﻿using Restaurant.Client.Controls;
using System;
using System.Windows;
using System.Windows.Controls;

namespace Restaurant.Client.Pages
{
    /// <summary>
    /// Business.xaml 的交互逻辑
    /// </summary>
    public partial class p_Business : Page
    {
        public p_Business()
        {
            InitializeComponent();
        }



      

        private void ShowCheck(u_BusinessItem sender)
        {
            if (null == sender) return;
            b_Check.Tag = sender;
            tb_Check_Title.Text = sender.Item;
            b_Check.Visibility = Visibility.Visible;
        }
        private void btn_check_Click(object sender, RoutedEventArgs e)
        { 
            var item = b_Check.Tag as u_BusinessItem;

            if (null == item) return;

            //写库

            //删除 
            wp_Main.Children.Remove(item);

            btn_Check_Close_Click(null, null);
        }

        private void btn_Check_Close_Click(object sender, RoutedEventArgs e)
        {
 
            //清除显示内容 

            //关闭
            b_Check.Visibility = Visibility.Hidden;
            g_Main.IsEnabled = true;
        }
        private void B_Check(u_BusinessItem sender)
        {
            g_Main.IsEnabled = false;
            ShowCheck(sender);
        }
        private void dh_Business_Setting_DialogClosing(object sender, MaterialDesignThemes.Wpf.DialogClosingEventArgs eventArgs)
        {
            try
            {
                //取消判断
                if (!Equals(eventArgs.Parameter, true)) return; 
                var b = new u_BusinessItem() { Margin = new Thickness(10) };
                b.Check += B_Check;
                wp_Main.Children.Add(b); 
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                txt_Add_Number.Text = "";
                txt_Add_Remarks.Text = "";
            }
        }
       

        //private void text_Click(object sender, RoutedEventArgs e)
        //{

        //    string url = "http://webapi.n21ce.com/api/ElectronicLot/GetList";
        //    var parameters = new Dictionary<string, string>();
        //    parameters.Add("CompanyFtp", "yiwangshengpai");


        //    var  result = HttpService.sendPost(url, parameters, "Post");

        //}

    }
}
